package com.wei.miaosha.access;

import com.wei.miaosha.domain.MiaoshaUser;

/**
 * Created by WeiZichen on 2018/10/3.
 * desc:将当前用户信息绑定到当前线程中
 */
public class UserContext {
    private static ThreadLocal<MiaoshaUser> userHolder = new ThreadLocal<MiaoshaUser>();

    public static void setUser(MiaoshaUser user) {
        userHolder.set(user);
    }

    public static MiaoshaUser getUser() {
        return userHolder.get();
    }
}
